package com.hc.oa.assertion.service;

import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.criterion.DetachedCriteria;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.data.provider.Criteria;
import com.bstek.dorado.data.provider.Page;
import com.bstek.dorado.hibernate.HibernateUtils;
import com.hc.oa.assertion.dao.AssertionDao;
import com.hc.oa.model.Assertion;
import com.hc.oa.model.Bdf2Assertion;


@Component("com.hc.assertionService")
public class AssertionService {
	//
	
	@Resource
	private AssertionDao assertionDao;
	
	@DataProvider
	public void getAssertion(Page<Bdf2Assertion> page) throws Exception{
		assertionDao.queryAllByPage(Bdf2Assertion.class, page);
	  }
	
	@DataResolver
	@Transactional
	public void saveAssertion(Collection<Bdf2Assertion> datas) throws Exception{
       for(Bdf2Assertion assertion:datas){
    	   assertion.setAssertInputdate(new Date());
       }
       assertionDao.persistEntities(datas);
	}

}
